﻿package me2day.api.data
{
	/**
	* Object that contains information about a Me2day user
	*/
	public class Me2dayUser
	{
		/**
		* id of Me2day user
		*/
		public var id:String;
		/**
		* openid of Me2day user
		*/
		public var openid:String;
		/**
		* Me2day nickname
		*/
		public var nickname:String;
		/**
		* Me2day face photo URL
		*/
		public var face:String;
		/**
		* Me2day Description
		*/
		public var description:String;
		/**
		* Homepage of Me2day User
		*/
		public var homepage:String;
		/**
		* Me2day user's URL
		*/
		public var me2dayHome:String;
		/**
		* daily rss
		*/
		public var rssDaily:String;
		/**
		* who is user parent
		*/
		public var invitedBy:String;
		/**
		* Me2day user's friends count
		*/
		public var friendsCount:int;
		/**
		* Last updated date
		*/
		public var updated:String;
		
		public var postIcons:Array;
		
		public var email:String;
		public var cellphone:String;
		public var messenger:String;
		
		public var defaultIcon:Me2dayPostIcon;
		
		function Me2dayUser(user:Object)
		{
			id = user.id;
			openid = user.openid;
			nickname = user.nickname;
			face = user.face;
			description = user.description;
			homepage = user.homepage;
			me2dayHome = user.me2dayHome;
			rssDaily = user.rssDaily;
			invitedBy = user.invitedBy;
			friendsCount = user.friendsCount;
			updated = user.updated;
			email = user["email"]
			cellphone = user["cellphone"]
			messenger = user["messenger"]
			
			postIcons = [];
			
			for each (var tempXML:XML in user.postIcons.children()) 
			{
				var postIcon:Me2dayPostIcon = new Me2dayPostIcon(tempXML);
                postIcons.push(postIcon);
                if ( postIcon.isDefault )
                	defaultIcon = postIcon;
            }
		}
	}
}